<template>
<div>
  <van-checkbox-group v-model="ids">
    <van-checkbox :key="i.id" :name="i.id" v-for="i in resourcelist">{{i.name}}</van-checkbox>
  </van-checkbox-group>
  <van-button @click="add_jues">添加</van-button>
</div>
</template>

<script>
export default {
  name: "pei",
  data(){
    return{
      ids:[],
      id:this.$route.query.id,
      resourcelist:[]
    }
  },
  methods:{
    getresource(){
      this.$axios.get('admin/resourceM').then(res=>{
        this.resourcelist = res.data.list
      })
    },
    add_jues(){
      this.$axios.post('admin/resourceM',{'rolesid':this.ids,'resid':this.id}).then(res=>{
        if(res.data.code==200){
          alert('ok')
        }else {
          alert('no')
        }
      })
    }
  },
  mounted() {
    this.getresource()
  }
}
</script>

<style scoped>

</style>
